var thisPage = {
    _bulletinId: "",
    // 初始化页面
    OnPageLoad: function () {
        thisPage.FetchBulletinById();
    },
    FetchBulletinById: function () {
        var _params = {};
        _params['HeaderId'] = thisPage._bulletinId;
        $.ajax({
            type: "POST",
            url: parent.basePath + "/oa/bulletin/fetchByBulletinId.html",
            timeout: 30 * 1000,
            data: JSON.stringify(_params),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            beforeSend: function () {
            }
        }).done(function (data) {
            thisPage._bulletinId = data.bulletinId;
            $("#Title").text(data.title);
            $("#StartTime").text(data.startTime);
            $("#EndTime").text(data.endTime);
            //$("#Contents").html(data.contents);
            window.CKEDITOR.instances.Contents.setData(data.contents);
            $("#Channel").val(data.channel);
            $("#Priority").val(data.priority);
            switch (data.priority) {
                case 0:
                    $("#Priority").css({color: "red"});
                    break;
                case 1:
                    $("#Priority").css({color: "blue"});
                    break;
            }
        }).fail(function (data) {
            $('#loading').hide();
            ajaxError(data, 1);
        }).always(function () {
            $('#loading').hide();
        });
    }
};

//-----------------------------------------------------------------------------
// 页面初始化
//-----------------------------------------------------------------------------
function onPageReady() {
    thisPage._bulletinId = $("#BulletinId").val();

    thisPage.OnPageLoad();
}

// 画面大小或者位置移动
function onPageResize() {
    let h = $(window).height();
    $("#Contents").css({height: h - 170});
}
